# 导包
import time
import unittest
import app
from scrpits.test01_login import TestLogin
from scrpits.test02_login_params import Test01_Login
from scrpits.test03_employee import TestEmployee
from tools.HTMLTestRunner import HTMLTestRunner
# 封装测试套件
suite = unittest.TestSuite()
# 登录接口测试用例
suite.addTest(unittest.makeSuite(Test01_Login))     #解决员工管理接口依赖登录接口问题
# 员工管理接口测试用例
suite.addTest(Test01_Login("test001_login"))
suite.addTest(unittest.makeSuite(TestEmployee))

# 指定测试报告路径
report = app.BASE_DIR + "/report/report-{}.html".format(time.strftime("%Y%m%d-%H%M%S"))
# 文件流形式打开文件
with open(report,"wb") as f:
    # 创建HTMLRunner运行器
    runner = HTMLTestRunner(f,title="IHRM人力资源测试报告")
    # 执行测试套件
    runner.run(suite)